home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- * Copyright © 1992-1993 Mark Pilgrim *
- * *
- * This file is provided as is, and may be freely distributed unaltered. This *
- * message must accompany any copy of this file. This file may be used or *
- * modified for use for a non-commercial product provided that appropriate *
- * credit is given to the author named above. *
- * Commercial use of this source code is prohibited. *
- ******************************************************************************/
-
- #include "msg misc.h"
- #include "msg timing.h"
-
- #define ScrollSize 10 /* = how much up to scroll each strip */
- #define BoxSize 5 /* = width of each strip */
- #define NumStrips 100 /* = MAIN_WINDOW_WIDTH/BoxSize */
- #define CorrectTime 2
-
- void PourScroll(GrafPtr);
-
- /* Scroll down in tiny strips, starting at the left and moving right. Scroll
- strips 1-(N), then strips 1-(N+1), etc. When strip 1 is done, don't do it
- anymore! (Duh, but this was difficult to get right.) So only scroll strips
- 2-(N), and so on. */
-
- void PourScroll(GrafPtr sourceGrafPtr)
- {
- Rect theRect[NumStrips], dest[NumStrips];
- Rect scrollsource, scrolldest;
- int i;
- int startstrip,endstrip;
-
- scrollsource=gMainWindow->portRect;
- scrollsource.bottom-=ScrollSize;
- scrollsource.left=0;
- scrollsource.right=BoxSize;
- scrolldest = scrollsource;
- OffsetRect(&scrolldest, 0, ScrollSize);
-
- for (i=0; i<NumStrips; i++)
- {
- dest[i] = gMainWindow->portRect;
- dest[i].bottom=ScrollSize;
- dest[i].left=i*BoxSize;
- dest[i].right=dest[i].left+BoxSize;
-
- theRect[i].top=MAIN_WINDOW_HEIGHT-ScrollSize;
- theRect[i].bottom=MAIN_WINDOW_HEIGHT;
- theRect[i].left=i*BoxSize;
- theRect[i].right=theRect[i].left+BoxSize;
- }
-
- startstrip=0;
- endstrip=1;
- do
- {
- StartTiming();
-
- CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
- &scrollsource, &scrolldest, 0, 0L);
-
- for (i=startstrip; i<endstrip; i++)
- {
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &theRect[i], &dest[i], 0, 0L);
- theRect[i].bottom-=ScrollSize;
- theRect[i].top-=ScrollSize;
- }
-
- if (endstrip<NumStrips)
- {
- endstrip++;
- scrollsource.right+=BoxSize;
- scrolldest.right+=BoxSize;
- }
- if (theRect[startstrip].bottom==0)
- {
- startstrip++;
- scrollsource.left+=BoxSize;
- scrolldest.left+=BoxSize;
- }
-
- TimeCorrection(CorrectTime);
- }
- while (startstrip<endstrip);
- }
-